home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / mail / smailsr2.lha / SMail / src / RCS / misc.c,v < prev    next >
Encoding:
Text File  |  1993-11-30  |  14.9 KB  |  813 lines

  1. head    2.4;
  2. access;
  3. symbols
  4.     C_2:2.4
  5.     C_1:1.5;
  6. locks; strict;
  7. comment    @ * @;
  8.  
  9.  
  10. 2.4
  11. date    93.12.01.00.25.17;    author Aussem;    state Exp;
  12. branches;
  13. next    2.3;
  14.  
  15. 2.3
  16. date    93.11.28.21.03.14;    author Aussem;    state Exp;
  17. branches;
  18. next    2.2;
  19.  
  20. 2.2
  21. date    93.11.28.16.01.05;    author Aussem;    state Exp;
  22. branches;
  23. next    2.1;
  24.  
  25. 2.1
  26. date    93.11.23.19.58.39;    author Aussem;    state Exp;
  27. branches;
  28. next    1.7;
  29.  
  30. 1.7
  31. date    93.11.20.23.50.31;    author Aussem;    state Exp;
  32. branches;
  33. next    1.6;
  34.  
  35. 1.6
  36. date    93.11.20.21.32.39;    author Aussem;    state Exp;
  37. branches;
  38. next    1.5;
  39.  
  40. 1.5
  41. date    93.11.06.15.59.47;    author Aussem;    state Exp;
  42. branches;
  43. next    1.4;
  44.  
  45. 1.4
  46. date    93.10.18.23.50.32;    author Aussem;    state Exp;
  47. branches;
  48. next    1.3;
  49.  
  50. 1.3
  51. date    93.09.18.16.47.47;    author Aussem;    state Exp;
  52. branches;
  53. next    1.2;
  54.  
  55. 1.2
  56. date    93.09.10.01.51.50;    author Aussem;    state Exp;
  57. branches;
  58. next    1.1;
  59.  
  60. 1.1
  61. date    93.09.08.16.27.13;    author Aussem;    state Exp;
  62. branches;
  63. next    ;
  64.  
  65.  
  66. desc
  67. @misc routines
  68. @
  69.  
  70.  
  71. 2.4
  72. log
  73. @timeozone now works correctly
  74. @
  75. text
  76. @/*
  77.  * Miscellaneous support functions for smail/rmail
  78.  *
  79.  * This program is free software; you can redistribute it and/or
  80.  * modify it under the terms of the GNU General Public License as
  81.  * published by the Free Software Foundation; either version 2 of
  82.  * the License, or (at your option) any later version.
  83.  *
  84.  * This program is distributed in the hope that it will be useful,
  85.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  86.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  87.  * General Public License for more details.
  88.  *
  89.  * You should have received a copy of the GNU General Public License
  90.  * along with this program; if not, write to the Free Software
  91.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  92.  *
  93.  * $Log: misc.c,v $
  94.  * Revision 2.3  1993/11/28  21:03:14  Aussem
  95.  * only in rmail mode the delivering time will be logged
  96.  *
  97.  * Revision 2.2  1993/11/28  16:01:05  Aussem
  98.  * get_time() insert
  99.  * maillog() will now logs the duration of delivering the mail
  100.  *
  101.  * Revision 2.1  1993/11/23  19:58:39  Aussem
  102.  * Version 2.0 check in
  103.  *
  104.  * Revision 1.7  1993/11/20  23:50:31  Aussem
  105.  * no ok, .. output if we are rmail
  106.  *
  107.  * Revision 1.6  1993/11/20  21:32:39  Aussem
  108.  * extended Debug options
  109.  *
  110.  * Revision 1.5  1993/11/06  15:59:47  Aussem
  111.  * maillog() now works better
  112.  *
  113.  * Revision 1.4  1993/10/18  23:50:32  Aussem
  114.  * enforcer hit in record() removed
  115.  *
  116.  * Revision 1.3  1993/09/18  16:47:47  Aussem
  117.  * insert GNU license text in the header
  118.  *
  119.  * Revision 1.2  1993/09/10  01:51:50  Aussem
  120.  * new support for wCNews styled logfile with maillog()
  121.  *
  122.  * Revision 1.1  1993/09/08  16:27:13  Aussem
  123.  * Initial revision
  124.  *
  125.  *
  126.  */
  127.  
  128. static char     *rcsid="$Id: misc.c,v 2.3 1993/11/28 21:03:14 Aussem Exp Aussem $";
  129.  
  130. # include    <stdio.h>
  131. # include    <stdlib.h>
  132. # include    <sys/types.h>
  133. # include    <ctype.h>
  134. # include    "defs.h"
  135. # include    <time.h>
  136.  
  137. extern int  exitstat;        /* set if a forked mailer fails */
  138. extern enum edebug debug;    /* how verbose we are         */
  139. extern enum ehandle handle;    /* what we handle        */
  140. extern char *uuxargs;        /* arguments given to uux       */
  141. extern int  queuecost;        /* threshold for queueing mail  */
  142. extern int  maxnoqueue;        /* max number of uucico's       */
  143. extern enum erouting routing;    /* when to route addresses    */
  144. extern char hostdomain[];    /* */
  145. extern char hostname[];        /* */
  146. extern char hostuucp[];        /* */
  147. extern char *pathfile;        /* location of path database    */
  148. extern char *spoolfile;        /* file name of spooled message */
  149. extern FILE *spoolfp;        /* file ptr  to spooled message */
  150. extern int spoolmaster;        /* set if creator of spoolfile  */
  151. extern char logfile[];
  152. extern char sentfile[];
  153. extern char dateline[];
  154.  
  155. char smarthost[SMLBUF];
  156.  
  157. struct tm *gmt, *loc;        /* GMT and local time structure    */
  158. time_t now;            /* current system time        */
  159. char nows[50];            /* time in ctime format        */
  160. char arpanows[50];        /* time in arpa format        */
  161.  
  162. # ifdef MAILLOG
  163. extern char maillogfile[];
  164. extern int asrmail;
  165.  
  166. void
  167. maillog(to_user,to_host, from, size,okay)
  168. char *to_user,*to_host;
  169. char *from;
  170. long size;
  171. char okay;
  172. {
  173. static FILE *fp=NULL;
  174. char *logtime, buf[SMLBUF];
  175.  
  176. logtime = strcpy(buf, nows);
  177. logtime[19] = '\0';
  178. logtime += 4;
  179.  
  180. if(debug==NO && !asrmail)
  181.     {
  182.    /* sorry CONSOLE: does not work :-( so I use * */
  183.    FILE *fp=fopen("*","w+");
  184.    if(to_host[0]!='\0')
  185.         fprintf(fp,"%s, mail sent from %s to %s via %s\n",okay?"Ok":"Error",from,to_user,to_host);
  186.    else
  187.         fprintf(fp,"%s, mail sent from %s to %s\n",okay?"Ok":"Error",from,to_user);
  188.    fclose(fp);
  189.    }
  190.  
  191. fp=fopen(maillogfile,"a");
  192. if(fp)
  193.     {
  194.    if(asrmail)
  195.        {
  196.        if(to_host[0]!='\0')
  197.             fprintf(fp,"%s: %c '%s' '%s!%s' %ld bytes %d days\n",logtime,okay,from,to_host,to_user,size,get_time(dateline));
  198.         else
  199.             fprintf(fp,"%s: %c '%s' '%s' %ld bytes %d days\n",logtime,okay,from,to_user,size,get_time(dateline));
  200.         fclose(fp);
  201.        }
  202.    else
  203.        {
  204.        if(to_host[0]!='\0')
  205.             fprintf(fp,"%s: %c '%s' '%s!%s' %ld bytes\n",logtime,okay,from,to_host,to_user,size);
  206.         else
  207.             fprintf(fp,"%s: %c '%s' '%s' %ld bytes\n",logtime,okay,from,to_user,size);
  208.         fclose(fp);
  209.        }
  210.     }
  211. }
  212. # endif
  213.  
  214. # ifdef RECORD
  215. FILE *
  216. record(command, from, size)
  217. char *command, *from;
  218. long size;
  219. {
  220.     FILE *fd;
  221.     char *logtime, buf[SMLBUF];
  222.  
  223.     logtime = strcpy(buf, nows);
  224.     logtime[19] = '\0';
  225.     logtime += 4;
  226.  
  227.     fd = fopen(sentfile, "a");
  228.     if(!fd)
  229.         return(NULL);
  230.     (void) fprintf(fd, "%s: %s, from %s, %ld bytes\n",
  231.                         logtime, command, from, size);
  232.     while(fgets(buf, sizeof(buf), spoolfp) != NULL) {
  233.         (void) fputs(buf, fd);
  234.     }
  235.     (void) fclose(fd);
  236.     return(NULL);
  237. }
  238. # endif
  239.  
  240.  
  241. setdates()
  242. {
  243.     (void) time(&now);
  244.     (void) strcpy(nows, ctime(&now));
  245.     gmt = gmtime(&now);
  246.     loc = localtime(&now);
  247.     (void) strcpy(arpanows, arpadate(nows));
  248. }
  249.  
  250. /*
  251. **  Note: This routine was taken from sendmail
  252. **
  253. **  ARPADATE -- Create date in ARPANET format
  254. **
  255. **    Parameters:
  256. **        ud -- unix style date string.  if NULL, one is created.
  257. **
  258. **    Returns:
  259. **        pointer to an ARPANET date field
  260. **
  261. **    Side Effects:
  262. **        none
  263. **
  264. **    WARNING:
  265. **        date is stored in a local buffer -- subsequent
  266. **        calls will overwrite.
  267. **
  268. **    Bugs:
  269. **        Timezone is computed from local time, rather than
  270. **        from whereever (and whenever) the message was sent.
  271. **        To do better is very hard.
  272. **
  273. **        Some sites are now inserting the timezone into the
  274. **        local date.  This routine should figure out what
  275. **        the format is and work appropriately.
  276. */
  277.  
  278. #ifdef AMIGA
  279. extern char *_TZ;
  280.  
  281. static short int DaysofMonth[]=
  282.   { 31, 28, 31, 30,
  283.     31, 30, 31, 31,
  284.     30, 31, 30, 31 };
  285.  
  286.  
  287. static char *Weekday[]=
  288. {
  289.   "Sun",
  290.   "Mon",
  291.   "Tue",
  292.   "Wed",
  293.   "Thu",
  294.   "Fri",
  295.   "Sat"
  296. };
  297.  
  298. static char *Month[]=
  299. {
  300.   "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
  301. };
  302.  
  303.  
  304. char *
  305. arpadate(ud)
  306.     register char *ud;
  307. {
  308.   struct tm *Time;
  309.   time_t t;
  310.   static char timestr[40]="";
  311.   char *timezone;
  312.   char *getenv();
  313.  
  314.   _TZ=timezone=strdup(getenv("TZ"));
  315.   __tzset();
  316.  
  317.   time(&t);
  318.   Time=localtime(&t);
  319.   if(Time)
  320.    sprintf(timestr, "%s, %02d %s %04d %02d:%02d:%02d %s",
  321.                        Weekday[Time->tm_wday],
  322.                        Time->tm_mday,
  323.                        Month[Time->tm_mon],
  324.                        Time->tm_year+1900,
  325.                        Time->tm_hour,
  326.                        Time->tm_min,
  327.                        Time->tm_sec,
  328.                        __tzdtn?__tzdtn:(__tzstn?__tzstn:"GMT"));
  329.   return timestr;
  330. }
  331. #else
  332. char *
  333. arpadate(ud)
  334.     register char *ud;
  335. {
  336.     register char *p;
  337.     register char *q;
  338.     static char b[40];
  339.     extern char *ctime();
  340.     register int i;
  341. #ifndef BSD
  342.     extern char *tzname[];
  343.     time_t t, time();
  344. #else
  345.     /* V7 and 4BSD */
  346.     struct timeb t;
  347.     extern struct timeb *ftime();
  348.     extern char *timezone();
  349. #endif
  350.  
  351.     /*
  352.     **  Get current time.
  353.     **    This will be used if a null argument is passed and
  354.     **    to resolve the timezone.
  355.     */
  356.  
  357. #ifndef BSD
  358.     (void) time(&t);
  359.     if (ud == NULL)
  360.         ud = ctime(&t);
  361. #else
  362.     /* V7 or 4BSD */
  363.     ftime(&t);
  364.     if (ud == NULL)
  365.         ud = ctime(&t.time);
  366. #endif
  367.  
  368.     /*
  369.     **  Crack the UNIX date line in a singularly unoriginal way.
  370.     */
  371.  
  372.     q = b;
  373.  
  374.     p = &ud[8];        /* 16 */
  375.     if (*p == ' ')
  376.         p++;
  377.     else
  378.         *q++ = *p++;
  379.     *q++ = *p++;
  380.     *q++ = ' ';
  381.  
  382.     p = &ud[4];        /* Sep */
  383.     *q++ = *p++;
  384.     *q++ = *p++;
  385.     *q++ = *p++;
  386.     *q++ = ' ';
  387.  
  388.     p = &ud[22];        /* 1979 */
  389.     *q++ = *p++;
  390.     *q++ = *p++;
  391.     *q++ = ' ';
  392.  
  393.     p = &ud[11];        /* 01:03:52 */
  394.     for (i = 8; i > 0; i--)
  395.         *q++ = *p++;
  396.  
  397.                 /* -PST or -PDT */
  398. #ifndef BSD
  399.     p = tzname[localtime(&t)->tm_isdst];
  400. #else
  401.     p = timezone(t.timezone, localtime(&t.time)->tm_isdst);
  402. #endif
  403.     if (p[3] != '\0')
  404.     {
  405.         /* hours from GMT */
  406.         p += 3;
  407.         *q++ = *p++;
  408.         if (p[1] == ':')
  409.             *q++ = '0';
  410.         else
  411.             *q++ = *p++;
  412.         *q++ = *p++;
  413.         p++;        /* skip ``:'' */
  414.         *q++ = *p++;
  415.         *q++ = *p++;
  416.     }
  417.     else
  418.     {
  419.         *q++ = ' ';
  420.         *q++ = *p++;
  421.         *q++ = *p++;
  422.         *q++ = *p++;
  423.     }
  424.  
  425.     p = &ud[0];        /* Mon */
  426.     *q++ = ' ';
  427.     *q++ = '(';
  428.     *q++ = *p++;
  429.     *q++ = *p++;
  430.     *q++ = *p++;
  431.     *q++ = ')';
  432.  
  433.     *q = '\0';
  434.     return (b);
  435. }
  436. #endif
  437.  
  438. /*
  439.  *    The user name "postmaster" must be accepted regardless of what
  440.  *    combination of upper and lower case is used.  This function is
  441.  *    used to convert all case variants of "postmaster" to all lower
  442.  *    case.  If the user name passed in is not "postmaster", it is
  443.  *    returned unchanged.
  444.  */
  445. char *
  446. postmaster(user)
  447. char *user;
  448. {
  449.     static char *pm = "postmaster";
  450.  
  451.     if(strcmpic(user, pm) == 0) {
  452.         return(pm);
  453.     } else {
  454.         return(user);
  455.     }
  456. }
  457.  
  458. /*
  459.  * Return 1 iff the string is "UUCP" (ignore case).
  460.  */
  461. isuucp(str)
  462. char *str;
  463. {
  464.     if(strcmpic(str, "UUCP") == 0) {
  465.         return(1);
  466.     } else {
  467.         return(0);
  468.     }
  469. }
  470.  
  471. /*
  472. ** sform(form) returns a pointer to a string that tells what 'form' means
  473. */
  474.  
  475. char *
  476. sform(form)
  477. enum eform form;
  478. {
  479.     if(form == ERROR)  return("ERROR");
  480.     if(form == LOCAL)  return("LOCAL");
  481.     if(form == DOMAIN) return("DOMAIN");
  482.     if(form == UUCP)   return("UUCP");
  483.     if(form == ROUTE)  return("ROUTE");
  484.     return("UNKNOWN");
  485. }
  486.  
  487. /*
  488. **
  489. **  getmynames(): what is my host name and host domain?
  490. **
  491. **  Hostname set by -h, failing that by #define HOSTNAME, failing
  492. **  that by gethostname() or uname().
  493. **
  494. **  Hostdomain set by -h, failing that by #define HOSTDOMAIN,
  495. **  failing that as hostname.MYDOM, or as just hostname.
  496. **
  497. **  See defs.h for the inside story.
  498. **
  499. */
  500.  
  501. getmynames()
  502. {
  503. #ifdef HOSTNAME
  504.     if (!*hostname)
  505.         (void) strcpy(hostname, HOSTNAME);
  506. #endif
  507. #ifdef GETHOSTNAME
  508.     if (!*hostname)
  509.         gethostname(hostname, SMLBUF - 1);
  510. #endif
  511. #ifdef UNAME
  512.     if (!*hostname) {
  513.         struct utsname site;
  514.  
  515.         if (uname(&site) < 0)
  516.             error(EX_SOFTWARE, "uname() call failed", 0);
  517.         (void) strcpy(hostname, site.nodename);
  518.     }
  519. #endif
  520.     if (!*hostname)
  521.         error(EX_SOFTWARE, "can't determine hostname.\n", 0);
  522. #ifdef HOSTDOMAIN
  523.     if (!*hostdomain)
  524.         (void) strcpy(hostdomain, HOSTDOMAIN);
  525. #endif
  526. #ifdef MYDOM
  527.     if (!*hostdomain)
  528.         (void) strcat(strcpy(hostdomain, hostname), MYDOM);
  529. #endif
  530. #ifdef AMIGA
  531.     if (!*hostdomain)
  532.         {
  533.         (void) getdomainname(hostdomain, SMLBUF - 1);
  534.         strins(hostdomain,hostname);
  535.         }
  536. #endif
  537.     if (!*hostdomain)
  538.         (void) strcpy(hostdomain, hostname);
  539.  
  540.     (void) strcat(strcpy(hostuucp, hostname), ".UUCP");
  541. #ifdef AMIGA
  542.     (void) getsmarthost(smarthost,SMLBUF - 1);
  543. #endif
  544.  
  545.  
  546. }
  547.  
  548. /*
  549.  * convert the Date: header to time_t value
  550.  *
  551.  * if any parsing error occured 0 is returned
  552.  *
  553.  */
  554. time_t
  555. get_time(char *ctime_string)
  556. {
  557.   const char *mo[12] =
  558.   {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
  559.     "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  560.   };
  561.   char mon[12];
  562.   struct tm ret;
  563.   register int i;
  564.   time_t mail,today,diff;
  565.  
  566.   /*
  567.   if(ctime_string[0]=='\0')
  568.       return(0);
  569.                 /* e.g: Date: Sun, 28 Nov 1993 13:25: */
  570.   sscanf (ctime_string, "%*s %*s %2d %s %d %2d:%2d:", &ret.tm_mday, mon, &ret.tm_year, &ret.tm_hour, &ret.tm_min);
  571.   for (i = 0; i < 12; i++)
  572.      if (!strncmp (mo[i], mon, 3))
  573.         break;
  574.   ret.tm_mon=i;
  575.   ret.tm_year %= 1900;
  576.   mail=mktime(&ret);
  577.   today=time(&today);
  578.   if(mail<1 || today<1)
  579.       return(0);
  580.   diff=difftime(today,mail);
  581.   if(diff<86400) /* 24hours*60mins*60secs = 1 day in secs*/
  582.       return(1);
  583.   return(((diff/60)/60)/24);
  584. }
  585. @
  586.  
  587.  
  588. 2.3
  589. log
  590. @only in rmail mode the delivering time will be logged
  591. @
  592. text
  593. @d19 3
  594. d53 1
  595. a53 1
  596. static char     *rcsid="$Id: misc.c,v 2.2 1993/11/28 16:01:05 Aussem Exp Aussem $";
  597. d239 2
  598. a240 1
  599.   timezone=getenv("TZ");
  600. d253 1
  601. a253 1
  602.                        timezone?timezone:"GMT");
  603. @
  604.  
  605.  
  606. 2.2
  607. log
  608. @get_time() insert
  609. maillog() will now logs the duration of delivering the mail
  610. @
  611. text
  612. @d19 4
  613. d50 1
  614. a50 1
  615. static char     *rcsid="$Id: misc.c,v 2.1 1993/11/23 19:58:39 Aussem Exp Aussem $";
  616. d116 17
  617. a132 6
  618.    if(to_host[0]!='\0')
  619.         fprintf(fp,"%s: %c '%s' '%s!%s' %ld bytes %d days\n",logtime,okay,from,to_host,to_user,size,get_time(dateline));
  620.     else
  621.         fprintf(fp,"%s: %c '%s' '%s' %ld bytes %d days\n",logtime,okay,from,to_user,size,get_time(dateline));
  622.     fclose(fp);
  623.    }
  624. @
  625.  
  626.  
  627. 2.1
  628. log
  629. @Version 2.0 check in
  630. @
  631. text
  632. @d19 3
  633. d46 1
  634. a46 1
  635. static char     *rcsid="$Id: misc.c,v 1.7 1993/11/20 23:50:31 Aussem Exp Aussem $";
  636. d71 2
  637. a109 1
  638.  
  639. d113 1
  640. a113 1
  641.         fprintf(fp,"%s: %c '%s' '%s!%s' %ld bytes\n",logtime,okay,from,to_host,to_user,size);
  642. d115 1
  643. a115 1
  644.         fprintf(fp,"%s: %c '%s' '%s' %ld bytes\n",logtime,okay,from,to_user,size);
  645. d137 1
  646. a137 1
  647.     (void) fprintf(fd, "%s: %s, from %s, %ld bytes\n",    
  648. d399 1
  649. a399 1
  650. **  
  651. d451 39
  652. @
  653.  
  654.  
  655. 1.7
  656. log
  657. @no ok, .. output if we are rmail
  658. @
  659. text
  660. @d19 3
  661. d43 1
  662. a43 1
  663. static char     *rcsid="$Id: misc.c,v 1.6 1993/11/20 21:32:39 Aussem Exp Aussem $";
  664. @
  665.  
  666.  
  667. 1.6
  668. log
  669. @extended Debug options
  670. @
  671. text
  672. @d19 3
  673. d40 1
  674. a40 1
  675. static char     *rcsid="$Id: misc.c,v 1.5 1993/11/06 15:59:47 Aussem Exp Aussem $";
  676. d74 1
  677. d90 1
  678. a90 1
  679. if(debug==NO)
  680. @
  681.  
  682.  
  683. 1.5
  684. log
  685. @maillog() now works better
  686. @
  687. text
  688. @d19 3
  689. d37 1
  690. a37 1
  691. static char     *rcsid="$Id: misc.c,v 1.4 1993/10/18 23:50:32 Aussem Exp Aussem $";
  692. d47 1
  693. a47 1
  694. extern enum edebug debug;    /* how verbose we are         */ 
  695. a68 10
  696. # ifdef LOG
  697. void
  698. log(command, from, size)
  699. char *command, *from;
  700. long size;
  701. {
  702. writelog(" cmd: \"%s\" from %s",command,from);
  703. }
  704. # endif
  705.  
  706. d85 11
  707. @
  708.  
  709.  
  710. 1.4
  711. log
  712. @enforcer hit in record() removed
  713. @
  714. text
  715. @d19 3
  716. d34 1
  717. a34 1
  718. static char     *rcsid="$Id: misc.c,v 1.3 1993/09/18 16:47:47 Aussem Exp Aussem $";
  719. d77 2
  720. d80 2
  721. a81 2
  722. maillog(to, from, size,okay)
  723. char *to;
  724. a85 1
  725. extern char maillogfile[];
  726. d93 1
  727. a93 2
  728. if(!fp)
  729.     fp=fopen(maillogfile,"a");
  730. d96 7
  731. a102 2
  732.     fprintf(fp,"%s: %c '%s' '%s' %ld bytes\n",logtime,okay,from,to,size);
  733.  
  734. @
  735.  
  736.  
  737. 1.3
  738. log
  739. @insert GNU license text in the header
  740. @
  741. text
  742. @d19 3
  743. d31 1
  744. a31 1
  745. static char     *rcsid="$Id: misc.c,v 1.2 1993/09/10 01:51:50 Aussem Exp Aussem $";
  746. d112 4
  747. a115 4
  748.     if (fd != NULL) {
  749.         (void) fprintf(fd, "%s: %s, from %s, %ld bytes\n",
  750.             logtime, command, from, size);
  751.     }
  752. @
  753.  
  754.  
  755. 1.2
  756. log
  757. @new support for wCNews styled logfile with maillog()
  758. @
  759. text
  760. @d2 1
  761. a2 1
  762.  *  Miscellaneous support functions for smail/rmail
  763. d4 14
  764. d19 3
  765. d28 1
  766. a28 1
  767. static char     *rcsid="$Id: misc.c,v 1.1 1993/09/08 16:27:13 Aussem Exp Aussem $";
  768. @
  769.  
  770.  
  771. 1.1
  772. log
  773. @Initial revision
  774. @
  775. text
  776. @d4 3
  777. a6 1
  778.  * $Log$
  779. d8 1
  780. d11 1
  781. a11 1
  782. static char     *rcsid="$Id$";
  783. a48 1
  784. #ifdef AMIGA
  785. d50 21
  786. a70 4
  787. #else
  788.     FILE *fd;
  789.     char *logtime, tbuf[50];
  790.     int cmask;
  791. d72 2
  792. a73 3
  793.     logtime = strcpy(tbuf, nows);
  794.     logtime[16] = '\0';
  795.     logtime += 4;
  796. a74 9
  797.     cmask = umask(0);
  798.     fd = fopen(logfile, "a");
  799.     (void) umask(cmask);
  800.     if (fd != NULL) {
  801.         (void) fprintf(fd, "%s\t%ld\t%s\t%s\n",
  802.             logtime, size, from, command);
  803.         (void) fclose(fd);
  804.     }
  805. #endif
  806. d88 1
  807. a88 1
  808.     logtime[16] = 0;
  809. d93 1
  810. a93 1
  811.         (void) fprintf(fd, "%s: %s, from %s, %ld bytes\n", 
  812. @
  813.